Skip to main content

Playwright E2E Testing: Best Practices

  • Most of the time, do not handle errors. Handle success only, since if it fails, it indicates the test does not work. This helps avoid unnecessary work.
  • Create a test workflow manually, then let GPT generate tests and check them.
  • GPT does not handle long code well, so split it into smaller parts.
  • Create tests from the user’s perspective and define expected results as test outcomes.
  • Use the immediate and direct feedback as results for quicker and more reliable testing.
  • Merge a few tests into one to reduce UI build time, but do this sparingly to avoid making the logic complex.
  • Remember to test for mobile browsers as well.
  • Show browsers during testing to verify the process.